import {  baseUrl } from "./config.js"

//首页的接口
export function topList() {
	
	return new Promise(function(reslove,reject) {
		uni.request({
		url:`${baseUrl}/toplist/detail`,
		method:'GET',
		success:res => {
			let result = res.data.list
			result.length=4
			reslove(result)
		}
	})
	})
	
}

//歌单详情页接口
export function list(id) {
	return uni.request({
		url:`${baseUrl}/playlist/detail?id=${id}`,
		method:'GET'
		
	})
}

//获取歌单详情
export function songDetail(id){
	return uni.request({
		url: `${baseUrl}/song/detail?ids=${id}`,
		method: 'GET'
	});
	
}

//获取相似音乐
export function songSimi(id){
	return uni.request({
		url: `${baseUrl}/simi/song?id=${id}`,
		method: 'GET'
		
	});
}

//歌曲评论
export function songComment(id){
	return uni.request({
		url: `${baseUrl}/comment/music?id=${id}`,
		method: 'GET'
		
	});
}

//获取歌词
export function songLyric(id){
	return uni.request({
		url: `${baseUrl}/lyric?id=${id}`,
		method: 'GET'
		
	});	
}

//获取音乐 url
export function songUrl(id){
	return uni.request({
		url: `${baseUrl}/song/url?id=${id}`,
		method: 'GET'
		
	});
}


// 热搜列表(详细)
export function searchHot(){
	return uni.request({
		url: `${baseUrl}/search/hot/detail`,
		method: 'GET'
		
	});
}

// 搜索关键词
export function searchWord(word){
	return uni.request({
		url: `${baseUrl}/search?keywords=${word}`,
		method: 'GET'
		
	});
	
	
}

// 搜索提示文字
export function searchSuggest(word) {
	return uni.request({
		url: `${baseUrl}/search/suggest?keywords=${word}&type=mobile`,
		method: 'GET'
	});
}